package cn.hd.service.impl;

import cn.hd.dao.FileuploadDao;
import cn.hd.entity.Fileupload;
import cn.hd.entity.FileuploadLicense;
import cn.hd.service.FileuploadSevice;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

@Service
@Transactional
public class FileuploadServiceImpl implements FileuploadSevice {
    @Autowired
    private FileuploadDao fileuploadDao;

    @Override
    public PageInfo<Fileupload> selectAllFenYeFileupload(Map map, int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<Fileupload> fileuploads = fileuploadDao.selectAllFileupload(map);
        PageInfo<Fileupload> pageInfo=new PageInfo<>(fileuploads);
        return pageInfo;
    }

    @Override
    public int addFileupload(Fileupload fileupload) {
        return fileuploadDao.addFileupload(fileupload);
    }

    @Override
    public Fileupload selectFileuploadById(long fileid) {
        return fileuploadDao.selectFileuploadById(fileid);
    }

    @Override
    public int updateFileupload(Fileupload fileupload) {
        return fileuploadDao.updateFileupload(fileupload);
    }

    @Override
    public int deleteFileupload(long fileid) {
        return fileuploadDao.deleteFileupload(fileid);
    }

    @Override
    public FileuploadLicense selectFileuploadLicenseByFid(long fileid) {
        return fileuploadDao.selectFileuploadLicenseByFid(fileid);
    }
}
